package com.spark.lola.controller.receiving;

import com.spark.lola.feign.PurReportFeignService;
import com.spark.lola.statistics.request.PurReportDateRequest;
import com.spark.lola.statistics.vo.PurchaseStatisticsVo;
import com.spark.lola.statistics.vo.PurchaseWorkVo;
import com.spark.lola.support.api.entity.EnterpriseTokenUser;
import com.spark.lola.support.common.util.ResponseBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: DengYeJun
 * @Date: 2020/5/20 17:45
 */
@Api(value = "/api/receiving/", tags = "接货员报表接口")
@RequestMapping("/api/receiving/")
@RestController
public class ReceivingReportController {

    @Autowired
    private PurReportFeignService purReportFeignService;

    /**
     * 接货员统计信息
     */
    @ApiOperation(value = "查询指定期间数据统计")
    @RequestMapping(value = "/statistics", method = RequestMethod.POST)
    ResponseBean supplierStatistics(@RequestBody PurReportDateRequest request, @SessionAttribute EnterpriseTokenUser<?> tokenUser) {
        PurchaseStatisticsVo vo = purReportFeignService.employeeStatistics(tokenUser.getShiroUser(), request.getStart(), request.getEnd());
        return ResponseBean.success(vo);
    }

    /**
     * 接货员待处理业务
     */
    @ApiOperation(value = "查询接货员待处理业务")
    @RequestMapping(value = "/work", method = RequestMethod.POST)
    ResponseBean supplierWork(@SessionAttribute EnterpriseTokenUser<?> tokenUser) {
        PurchaseWorkVo vo = purReportFeignService.employeeWork(tokenUser.getShiroUser());
        return ResponseBean.success(vo);
    }

}
